package com.engine4cloud.tdf.supervision.convert;

import com.engine4cloud.tdf.supervision.dto.create.JzdxPhysicalConditionCreateDTO;
import com.engine4cloud.tdf.supervision.dto.update.JzdxPhysicalConditionUpdateDTO;
import com.engine4cloud.tdf.supervision.entity.JzdxPhysicalConditionEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface JzdxPhysicalConditionConvert {
    JzdxPhysicalConditionConvert INSTANCE = Mappers.getMapper(JzdxPhysicalConditionConvert.class);

    @Mapping(target = "id", ignore = true)
    JzdxPhysicalConditionEntity createTo(JzdxPhysicalConditionCreateDTO s);

    JzdxPhysicalConditionEntity update(JzdxPhysicalConditionUpdateDTO s);

    JzdxPhysicalConditionCreateDTO updateCreate(JzdxPhysicalConditionUpdateDTO s);

    default JzdxPhysicalConditionEntity create(JzdxPhysicalConditionCreateDTO s, String code, Long tenantId) {
        JzdxPhysicalConditionEntity entity = createTo(s);
        entity.setRybh(code);
        entity.setTenantId(tenantId);
        return entity;
    }
}
